package tjs.study.notes.dotest.proxy.spring.springLoad;

import org.checkerframework.checker.units.qual.C;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * Created by Nicky.Tang on 2021/10/6 10:39 下午
 *
 * @since 02.12.10
 */
@Service
public class UserTestService {
    @Autowired
    private UserTestService2 userTestService2222;

    public String doTest() {
        UserTestService2 userTestService2Test = new UserTestService2();
        userTestService2Test.doTest2();
        return userTestService2222.doTest3();
    }

//    public String doTest() {
//        int var10000 = r$type.changed(0);
//        if (var10000 != 0) {
//            if (var10000 != 1) {
//                throw new NoSuchMethodError("tjs.study.notes.dotest.proxy.spring.springLoad.UserTestService.doTest()Ljava/lang/String;");
//            } else {
//                return (String)((UserTestService__I)r$type.fetchLatest()).doTest(this);
//            }
//        } else {
//            UserTestService2 var3 = new UserTestService2;
//            Object var10002 = TypeRegistry.ccheck(301, "()V");
//            if (var10002 != null) {
//                __DynamicallyDispatchable var1 = (__DynamicallyDispatchable)var10002;
//                var3.<init>((C)null);
//                var1.__execute((Object[])null, var3, "<init>()V");
//            } else {
//                var3.<init>();
//            }
//
//            UserTestService2 userTestService2Test = var3;
//            if (TypeRegistry.ivicheck(301, "doTest2()Ljava/lang/String;")) {
//                String var4 = (String)userTestService2Test.__execute((Object[])null, userTestService2Test, "doTest2()Ljava/lang/String;");
//            } else {
//                userTestService2Test.doTest2();
//            }
//
              // 先获取最新class的实例 todo 如何实现的
//            var3 = TypeRegistry.instanceFieldInterceptionRequired(300, "userTestService2222") ? (UserTestService2)this.r$get(this, "userTestService2222") : this.userTestService2222;
              // 然后通过java反射调用目标方法，fixme 因此可以新增方法
//            return TypeRegistry.ivicheck(301, "doTest3()Ljava/lang/String;") ? (String)var3.__execute((Object[])null, var3, "doTest3()Ljava/lang/String;") : var3.doTest3();
//        }
//    }

    public String doTest2() {
        return userTestService2222.doTest2();
    }

//    public String doTest3() {
//        return "Hellow world service3 3 !";
//    }
}
